<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<title><spring:message code="bigcargo_create_style" /></title>
<link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
<link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
<link rel="stylesheet" href="${ctxStatic}/css/list.css">
<script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
<script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
<script src="${ctxStatic}/js/common.js"></script>
<script>
	$(document).ready(function() {
		findBrand('${bigcargoStyleTempID.styleOgnizaitonTemp}','${bigcargoStyleTempID.brandId}');
		// 下拉选框带搜索功能
		selectCheck();
		var windowH = window.innerHeight
		|| document.documentElement.clientHeight
		|| document.body.clientHeight
		$('.tabSm').css({
			'height' : windowH - 77,
		});
		$('.tableScrollSm').css({
			'height' : windowH - 91
		})
		var difkbn = $("#difkbn").val();
		if (difkbn==1) {
				 checkBtnInputAll();
				$("#titleMessage").html("<spring:message code='bigcargo_view_style' />");
				$("#changeBtn").html("<spring:message code='write_style_btn' />");
				$("#changeBtn").click(function(){
					$("tbody .tab-cz").attr("onclick","removeFun(this)");
					$("tbody .tab-cz").html("<img src='${ctxStatic}/images/del_icon.png' class='delBtn'>");
					$("#refStyleBtn").attr("disabled",false);
					document.getElementById("refStyleBtn").style.color="#fff";
					$("#titleMessage").html("<spring:message code='edit_style' />");
                    $("#imgFlg").val(1);
                    $("#upOrCreateflg").val(0);
                    $("#auxiliaryPlaneBatching").show();
                    $("#opinionRequest").show();
                    $("#uploadFile").show();
                    $("#selectTemp").show();
					$("#nameImagePreview").find("a").show();
                    checkBtnInputOff();
				});
		} else {
			$("#changeBtn").attr("onclick","saveForm.save(0)");
			$("#sizeGroup").attr("disabled", 'false');
		}
	});
	
	// 查看画面个入力框制御 全画面制御
	function checkBtnInputAll() {
		$("tbody .tab-cz").removeAttr("onclick");
		 $("tbody .tab-cz").html("");
		$("#refStyleBtn").attr("disabled","disabled");
		document.getElementById("refStyleBtn").style.color="gray";
		$("#inputForm").find(".inputClass").attr("disabled", 'false');
		$("#inputForm").find("select").attr("disabled", 'false');
		$("#inputForm").find("textarea").attr("disabled", 'false');
		$("#inputForm").find(".btn").hide();
		$("#inputstyleGroup").find("input").attr("disabled",'false');
		$("#auxiliaryPlaneBatching").hide();
		$("#opinionRequest").hide();
		$("#uploadFile").hide();
		$("#produceAdd").hide();
        $("#nameImagePreview").find("a").hide();
        var selLen = $("#changeMaterialBody").find("select").length-1;
        for (var i = 0; i<selLen;i++) {
            $("#selectTemp"+i).hide();
            $("#mpt"+i).select2();
        }
	}
	// 各tab页解除制御
	function checkBtnInputOff(){
            var selLen = $("#changeMaterialBody").find("select").length-1;
            for (var i = 0; i<selLen;i++) {
                $("#tdTemp"+i).hide();
                $("#selectTemp"+i).show();
            }
            materialTabClick();
            $("#changeBtn").html("<spring:message code='btn_ok' />");
            $("#changeBtn").attr("onclick","saveForm.save(0)");
            $("#inputForm").find(".inputClass").removeAttr("disabled", 'true');
            $("#inputForm").find("select").removeAttr("disabled", 'true');
            $("#inputForm").find("textarea").removeAttr("disabled", 'true');
            $("#inputForm").find(".btn").show();
        	$("#produceAdd").show();
            callBackUpload();
            onClickTd();
	}
	var tempIndex;
	// tab页切换方法
	$(function() {
		$(".tabBox ul li").each(
			function() {
			var index = $(this).index();
			$(".tabBox ul li").eq(0).addClass("active");
			//画面初期 所有按钮变灰 
			document.getElementById("auxiliaryPlaneBatching").style.color="gray";
			document.getElementById("opinionRequest").style.color="gray";
			document.getElementById("uploadFile").style.color="gray";
			document.getElementById("produceAdd").style.color="gray";
			$(this).click(function() {
				//点击 款式信息 和 规格尺寸 tab页  所有按钮变灰 
				if (index==0||index==1) {
					document.getElementById("auxiliaryPlaneBatching").style.color="gray";
					document.getElementById("opinionRequest").style.color="gray";
					document.getElementById("uploadFile").style.color="gray";
					document.getElementById("produceAdd").style.color="gray";
				//点击 面辅配料 tab页 对应按钮点亮 其他变灰
				}else if (index==2) {
					document.getElementById("auxiliaryPlaneBatching").style.color="#fff";
					document.getElementById("opinionRequest").style.color="gray";
					document.getElementById("uploadFile").style.color="gray";
					document.getElementById("produceAdd").style.color="gray";
				//点击 意见反馈 tab页 对应按钮点亮 其他变灰
				}else if (index==3) {
					document.getElementById("auxiliaryPlaneBatching").style.color="gray";
					document.getElementById("opinionRequest").style.color="#fff";
					document.getElementById("uploadFile").style.color="gray";
					document.getElementById("produceAdd").style.color="gray";
				//点击 工艺要求 tab页 对应按钮点亮 其他变灰
				}else if (index==4) {
					document.getElementById("auxiliaryPlaneBatching").style.color="gray";
					document.getElementById("opinionRequest").style.color="gray";
					document.getElementById("uploadFile").style.color="gray";
					document.getElementById("produceAdd").style.color="#fff";
				//点击 资料文件 tab页 对应按钮点亮 其他变灰
				}else if (index==5) {
					document.getElementById("auxiliaryPlaneBatching").style.color="gray";
					document.getElementById("opinionRequest").style.color="gray";
					document.getElementById("uploadFile").style.color="#fff";
					document.getElementById("produceAdd").style.color="gray";
				}
				// 款式类别
				var stylcategory = $('#StyleCategorySelect').find('option:selected').val();
                var styleGroup = $('#styleGroup').val();
				if ((index==1 || index==4) && stylcategory == "") {
					alert('<spring:message code="select_style_opinion" />');
					return;
				} else if (index==1 && styleGroup == null) {
                    alert('<spring:message code="select_style_group" />');
                    return;
				}
				$(this).addClass("active").siblings()
						.removeClass("active");
				$(".tabBoxSm > .tabSm").eq(index).stop(true)
						.show().siblings().stop(true).hide();
				btnCheck(index);
				var tableW = $(".tabBoxSm > .tabSm").eq(index)
						.find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index)
						.find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(
						index).find('.tableScroll').height();
				if (tabodyH > tableScrollH) {
					$(".tabBoxSm > .tabSm").eq(index).find(
							'.tableScroll').css('width',
							tableW + 18 + 'px')
				} else {
					$(".tabBoxSm > .tabSm").eq(index).find(
							'.tableScroll').css('width',
							'990px')
				}
			})
		})
	})
	// 按钮互相制约
	function btnCheck(index) {
		if (index == 1) {
				$("#specSize").removeAttr("disabled");
				if (!$("#auxiliaryPlaneBatching").attr("disabled")) {
					$('#auxiliaryPlaneBatching').attr("disabled", "disabled");
				}
				if (!$("#opinionRequest").attr("disabled")) {
					$('#opinionRequest').attr("disabled", "disabled");
				}
				if (!$("#uploadFile").attr("disabled")) {
					$('#uploadFile').attr("disabled", "disabled");
				}
		} else if (index == 2) {
			$("#auxiliaryPlaneBatching").removeAttr("disabled");
			if (!$("#opinionRequest").attr("disabled")) {
				$('#opinionRequest').attr("disabled", "disabled");
			}
			if (!$("#uploadFile").attr("disabled")) {
				$('#uploadFile').attr("disabled", "disabled");
			}

		} else if (index == 3) {
			$("#opinionRequest").removeAttr("disabled");
			if (!$("#auxiliaryPlaneBatching").attr("disabled")) {
				$('#auxiliaryPlaneBatching').attr("disabled", "disabled");
			}
			if (!$("#uploadFile").attr("disabled")) {
				$('#uploadFile').attr("disabled", "disabled");
			}

		} else if (index == 4) {
            $("#produceAdd").removeAttr("disabled");
            if (!$("#auxiliaryPlaneBatching").attr("disabled")) {
                $('#auxiliaryPlaneBatching').attr("disabled", "disabled");
            }
            if (!$("#uploadFile").attr("disabled")) {
                $('#uploadFile').attr("disabled", "disabled");
            }
            if (!$("#opinionRequest").attr("disabled")) {
                $('#opinionRequest').attr("disabled", "disabled");
            }
		} else if (index == 5) {
            $("#uploadFile").removeAttr("disabled");
            if (!$("#auxiliaryPlaneBatching").attr("disabled")) {
                $('#auxiliaryPlaneBatching').attr("disabled", "disabled");
            }
            if (!$("#produceAdd").attr("disabled")) {
                $('#produceAdd').attr("disabled", "disabled");
            }
		}
	}
	
	function onClickTd() {
	    $("#tableSizeDis td").not(".none").find("td[class^='tab-']").on("click",function(){
	    	 //找到当前鼠标单击的td
	        var tdObj = $(this);
            //保存原来的文本
            var oldText = $(this).text();
			var tdId = $(tdObj)[0].id;
	        //创建一个文本框
            var inputTemp;
			if (tdId == 'fitMarks') {
                inputTemp = "<input tyle = 'text' value = '"+$(this).text()+"'  maxlength = '200'>";
			} else {
                inputTemp = "<input tyle = 'text' value = '"+$(this).text()+"'  maxlength = '6'>";
			}
	        var inputObj = $(inputTemp);
	        //去掉文本框的边框  
	        inputObj.css("border-width", 0);
	        inputObj.click(function () {
	            return false;
	        });
	        //使文本框的宽度和td的宽度相同  
	        inputObj.width(tdObj.width()-5);
	        inputObj.height(tdObj.height()-15);;
	        //去掉文本框的外边距 
	        inputObj.css("margin", 0);
	        inputObj.css("padding", 0);
	        //把文本框放到td中  
	        tdObj.html(inputObj);
	        //文本框失去焦点的时候变为文本  
	        inputObj.blur(function () {
	            var newText = $(this).val();
	            if (newText==null||newText=='') {
	            		newText = '-';
				}
                $(this).parent().parent().find("." + tdId).val(newText);
	            tdObj.html(newText);
	        });
	        //全选  
	        inputObj.trigger("focus").trigger("select");
	   });
	}
	// 尺码组和款式尺码连动方法
	function styleSizeCdFun(t, id) {
		var code = $(t).find("option:selected").attr("data-value");
		var param = {
			"code" : code
		};
		var count = $("ul.select2-choices").find("li.select2-search-choice").length;
		if (count > 0) {
			var thisNode = $("ul.select2-choices").find(
				"li.select2-search-choice");
			thisNode.remove();
			$("#input" + id).html("");
		}
		$.post("${ctx}/bigcargo/style/styleSize",param,function(result) {
			var html = "";
			$.each(result,function(i, e) {
				html += "<option value='"+e.itemCode+"-"+e.itemValue+"'>"
					+ e.itemName
					+ "</option>";
			});
			$("#" + id).html(html);
			$("#tableSizeDis td").not(".none").find(".fitTableVal").parent().remove();
		}, 'json');
	}
	// 删除行
	function removeFun(obj) {
		$(obj).parent().remove();
	}
	// 面辅配料画面回调方法
	function selectMaterialCallBack(indexList,itemObj) {
        var trTemp;
        var tempDataCells="";
        var tbodyTemp=$("#changeMaterialBody");
		var itemLen = indexList.split(",").length;
		var hiddenTemp="";
		var count = $("#changeMaterialBody").find("select").length-1;
		   $(itemObj).each(function(j,item){
                for (var i = 0; i < itemLen; i++) {
					if (indexList.split(",")[i] == j) {

						trTemp=$("#changeMaterialBody").find(".none").clone();
						tempDataCells=$(trTemp)[0].cells;
                        tempDataCells[1].innerHTML=item.materialTypeCn;
						if (itemObj[j].fileName=="") {
                            tempDataCells[2].innerHTML="<p class='tab-mfltp'><img src='${ctxStatic}/images/pic-none.jpg'></p>";
						} else {
                            tempDataCells[2].innerHTML="<p class='tab-mfltp'><img src='"+itemObj[j].fileName+"'></p>";
						}
                        tempDataCells[3].innerHTML=item.materialNameCn+"<br>"+item.materialCode;
                        /* tempDataCells[4].innerHTML=item.materialgramWeight; */
                        tempDataCells[4].innerHTML=item.materialComposition;
                        /* tempDataCells[6].innerHTML=item.materialThreadCount; */
                        tempDataCells[5].innerHTML=item.materialStyleCn;
                        tempDataCells[6].innerHTML=item.materialColor;
                        tempDataCells[7].innerHTML=item.materialWeaveCn;
                        $(trTemp).find("select")[0].id = "mpt" + count;
                        $(trTemp).find("select")[0].name="changeMaterial.cgMatList[tempIndex].cgMaterialPlacement";
                        tempDataCells[9].innerHTML=item.materialQuantity;
                        hiddenTemp = "<input type='hidden' class = 'materialRemarks' name='changeMaterial.cgMatList[tempIndex].cgMaterialRemarks'/>"+
                            "<input type='hidden' class = 'materialUnit' name='changeMaterial.cgMatList[tempIndex].materialCostUnit'/>"+
                            "<input type='hidden' name='changeMaterial.cgMatList[tempIndex].cgMaterialStageCd' value='AUDIT_PHASE_CD-PHASE_CD_10'/>"+
                            "<input type='hidden' name='changeMaterial.cgMatList[tempIndex].materialUnitPrice' value='0'/>"+
                            "<input type='hidden' name='changeMaterial.cgMatList[tempIndex].cgMaterialId' value='"+item.materialId+"'/>";
                        tempDataCells[12].innerHTML=hiddenTemp;
                        $(trTemp)[0].className="";
                        trTemp.appendTo(tbodyTemp);
                        $("#mpt"+count).select2();
                        count++;
					}
                }
            });
        materialTabClick();
	}
	function materialTabClick() {
        $("#changeMaterialBody").find("td[class^='tabwrite-']").click(function () {
            //找到当前鼠标单击的td
            var tdObj = $(this);
            //保存原来的文本
            var oldText = $(this).text();
            var idTemp= tdObj[0].id;
            var inputObj
            //创建一个文本框
            if (idTemp == "materialRemarks") {
                inputObj = $("<textarea value='"+oldText+"'>"+oldText+"</textarea>");
            } else {
                inputObj = $("<input type='text' value='"+oldText+"' onblur='formatMoney(this,3);' onfocus='unFormat(this)'/>");
            }
            var index = $(this).parent().index();
            //去掉文本框的边框
            inputObj.css("border-width", 0);
            inputObj.click(function () {
                return false;
            });
            //使文本框的宽度和td的宽度相同
            inputObj.width(tdObj.width()-4);
            inputObj.height(tdObj.height()-6);
            //去掉文本框的外边距
            inputObj.css("margin", 0);
            inputObj.css("padding", 0);
            //把文本框放到td中
            tdObj.html(inputObj);
            //文本框失去焦点的时候变为文本
            inputObj.blur(function () {
                var newText = $(this).val();
                tdObj.html(newText);
                newText = newText.replace(/,/g,"");
                $("#changeMaterialBody tr").eq(index).find("." + idTemp).val(newText);
            });
            //全选
            inputObj.trigger("focus").trigger("select");
        });
	}
	// 文件上传画面的回调方法
	function callBackUpload() {
		 //给这些单元格注册鼠标点击事件  
	    $("#uploadFileData").find(".tab-bz-2").click(function () {
	        //找到当前鼠标单击的td
	        var tdObj = $(this);
	        //保存原来的文本  
	        var oldText = $(this).text();
	        //创建一个文本框  
	        var inputObj = $("<textarea id='uploadRemarks' value='"+oldText+"'>"+oldText+"</textarea>");
	        var index = $(this).parent().index();
	        //去掉文本框的边框  
	        inputObj.css("border-width", 0);
	        inputObj.click(function () {
	            return false;
	        });
	        //使文本框的宽度和td的宽度相同  
	        inputObj.width(tdObj.width()-4);
	        inputObj.height(tdObj.height()-4);
	        //去掉文本框的外边距 
	        inputObj.css("margin", 0);
	        inputObj.css("padding", 0);
	        //把文本框放到td中  
	        tdObj.html(inputObj);
	        //文本框失去焦点的时候变为文本  
	        inputObj.blur(function () {
	            var newText = $(this).val();
                $("#uploadFileData tr").eq(index).find(".remarks").val(newText);
	            tdObj.html(newText);
	        });
	    });
	}
	// 款式参考画面和文件上传迁移方法
	function fileUpload(flg) {
		if (flg == 0) {
			popup('500px','324px','${ctx}/bigcargo/style/uploadFileMaterial?uploadFlg='+$("#uploadFlg").val());
		} else {
			popup('900px','584px','${ctx}/bigcargo/style/refStyleSel');
		}
	}
	// 规格尺码生成HTMl
	var sizeGroup ="";
	// 物料类别选择
	function changeSizeLayout() {
		var selectCode = $('#StyleCategorySelect').find('option:selected').val();
		var selectCodeTemp = selectCode.split("-");
 		$.post("${ctx}/bigcargo/style/doStyleSizeLayout?popupCategoryCd=" + selectCode,"",function(result) {
 			$("#sizeGroup").removeAttr("disabled", 'true');
 			 var sizeGroup = result["sizeFitPropertyList"];
             var productionHtml = result["strProductionHtml"];
 			$("#fitProperty").html(sizeGroup);
            $("#productionTable").html(productionHtml);
 		}, 'json');
	}
	
    /*保存方法*/
    var saveForm={
            s:null,
            save:function(s){
                            $("#inputForm").validate({
                                submitHandler : function() {
                                	saveFormData();
                                	setIndex();
                                    var params = $("#inputForm").serialize();
                                    $.post("${ctx}/bigcargo/style/saveData", params, function(result) {
                                    	tipParent(result.message);
                                    	window.parent.frames[0].searchListForm();
                                    	closeWin();
                                    }, 'json'); 
                                }
                            });
                            $("#inputForm").submit(); 
                           }
     }
	
	// 画面保存
   function saveFormData() {
		// 图片路径和名称
		var fileList = $("#nameImage").val().split("|/");
		var len = fileList.length;
		var pathHidden = '';
		var fileNamePathHidden = '';
		var ftpFileHidden = '';
		var moduleKbnHidden = '';
		var createUserHidden='';
		var createDateHidden='';
		var ftpKbnHidden='';
       var difkbn = $("#difkbn").val();
       if (difkbn == 1) {
           $("#upStyleId").val($("#tmpStyleId").val());
	   }
		// 生成路径
		for (var i = 1; i < len; i++) {
			var fileTemp = fileList[i].split("/");
			var urlTemp = '';
			var lenTemp = fileTemp.length;
			var nameTemp=fileTemp[lenTemp-1];
			if (fileList[i]!='') {
				for (var j = 0; j < (lenTemp-1); j++) {
					 urlTemp += fileTemp[j]+"/";
				}
				 pathHidden +='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].filePath" value = "/'+urlTemp+'"/>';
				 fileNamePathHidden+='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].uploadFileName" value = "'+nameTemp+'"/>';
				 ftpFileHidden+='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].ftpFile" value = "/bigcargoStyle"/>';
				 ftpKbnHidden+='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].fileKbn" value = "0"/>';
				 moduleKbnHidden+='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].moduleKbn" value = "2"/>';
				 createUserHidden+='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].createUser" value = "'+$("#createUser").val()+'"/>';
				 createDateHidden+='<input type ="hidden" name ="uploadFileData.imageList['+(i-1)+'].createTime" value = "'+$("#createDate").val()+'"/>';
			}
		}
		$("#fileListHidden").html(pathHidden+fileNamePathHidden+ftpFileHidden+moduleKbnHidden+createUserHidden+createDateHidden+ftpKbnHidden);
		// 客户取得
	   var selectCode = $('#bigcargoCustomerSelect').find('option:selected').val();
		/* // 款式季节
	   var stylSeason = $('#myMaterialSeasonSelect').find('option:selected').val(); */
		// 款式类别
		var stylcategory = $('#StyleCategorySelect').find('option:selected').val();
		
		if (selectCode!='') {
			var imageTemp = selectCode.split("-");
			// 客户简称
			$("#ognizaitonSimpleName").val(imageTemp[1]);
			// 客户ID
			$("#bigcargoCustomer").val(imageTemp[0]);
		}
		/* if (stylSeason!='') {
			var seasonTemp = stylSeason.split("-");
			// 款式季节ID
			$("#materialSeasonCd").val(seasonTemp[2]);
			// 款式季节
			$("#materialSeason").val(seasonTemp[0]+'-'+seasonTemp[1]);
		} */
		if (stylcategory!='') {
			var categoryTemp = stylcategory.split("-");
			// 款式类别ID
			$("#styleCategoryId").val(categoryTemp[2]);
			// 款式类别
			$("#styleCateGoryCd").val(categoryTemp[0]+"-"+categoryTemp[1]);
		}
    }
	// 款式尺码选择 样品画面和规格尺寸画面联动
    function styleFun(obj) {
		// 尺码组总数
		var liLen = $("#s2id_styleGroup").find(".select2-search-choice").length;
		// 规格尺寸数量
		var trLen = $("#tableSizeDis table").length-4;

		var liVal = "";
		var trVal = "";
		if (liLen > trLen) {
			if (trLen >= 1) {
				for (var i = 0; i < liLen; i++) {
					var staticFlg = true;
					liVal = $("#s2id_styleGroup").find(".select2-search-choice")[i].innerText;
					for (var j = 0; j < trLen; j++) {
						trVal = $("#tableSizeDis td").not(".none").find("th").eq(j+3).html();
						if (trim(liVal) == trim(trVal)) {
							staticFlg = true;
							break;
						} else {
							staticFlg = false;
						}
					}
					if (!staticFlg) {
                        var tableFit = $("#tableSizeDis tr>td.none").clone();
                        var reg=/tempIndex/g;
						$(tableFit).html($(tableFit).html().replace(reg,i+1));
						$(tableFit).find('input[type="hidden"]').removeAttr("disabled");
						$(tableFit).find('.styleGroup').val(macth(obj,liVal));
						$(tableFit)[0].className="";
                        $(tableFit).find("th").text(liVal);
                        $("#tableSizeDis tr.valTr").append("<td>"+$(tableFit).html()+"</td>");
						onClickTd();
					}
				}
			} else {
				var tableFit = $("#tableSizeDis tr>td.none").clone();
				var reg=/tempIndex/g;
				$(tableFit).html($(tableFit).html().replace(reg,1));
				$(tableFit).find('input[type="hidden"]').removeAttr("disabled");
				$(tableFit).find('.styleGroup').val(macth(obj,$("#s2id_styleGroup").find(".select2-search-choice")[0].innerText));
				$(tableFit)[0].className="";
                $(tableFit).find("th").text($("#s2id_styleGroup").find(".select2-search-choice")[0].innerText);
                $("#tableSizeDis tr.valTr").append("<td>"+$(tableFit).html()+"</td>");
				onClickTd();
			}
		} else {
			if (liLen > 0) {
				for (var i = 0; i <  trLen; i++) {
					var staticFlgTemp = false;
					trVal = $("#tableSizeDis td").not(".none").find("th").eq(i+3).text();
					for (var j = 0; j < liLen; j++) {
						liVal = $("#s2id_styleGroup").find(".select2-search-choice")[j].innerText;
						if (liVal==trim(trVal)) {
							staticFlgTemp = true
							break;
						} else {
							trRowNo = i;
						}
					}
					if (!staticFlgTemp) {
						$("#tableSizeDis td").not(".none").find(".fitTableVal").eq(trRowNo+1).parent().remove();
						return;
					}
				}
			} else {
                $("#tableSizeDis td").not(".none").find(".fitTableVal").eq(0).parent().remove();
			}
		}
    }
	// 尺码组code值匹配
	function macth (obj,val) {
		var seleLen = obj.options.length;
		for (var i = 0; i < seleLen; i++) {
			if (trim(val)==obj.options[i].text) {
				return obj.options[i].value;
			}
		} 
	}
	// 参考款式的选择BTN(主画面查看BTN)
	function selectStyleCallBack(tabFlg,disableFlg) {
		// 款式选择画面取得值
        // 款式类别
        var selectCode = $('#StyleCategorySelect').find('option:selected').val().split("-");
        var styleId = $("#tmpStyleId").val();
        var styleFile = $("#tmpUploadFile").val();
		 selectCheck();
		 // 通过款式ID 文件ID获取画面对应的值或list
		 $.post("${ctx}/bigcargo/style/selectStyle?styleID="+styleId+"&styleFile="+styleFile
			 +"&popupCategoryCd="+(selectCode[1]+"_FIT_ITEM")+"&tabFlg="+tabFlg, "", function(result) {
			 if (tabFlg == "STYLE_MASSAGE") {
                 var html = "";
                 // 款式尺码
                 var styleSizeHtml = result["styleSizeHtml"];
                 // 款式图片
                 var styleImageList = result["imageListHtml"];
                 var styleImageHidden = result["urlTemp"];
                 $("#nameImagePreview").html(styleImageList);
                 $("#nameImage").val(styleImageHidden);
                 // 从DB检出的尺码list重新生成HTML
                 $("#styleGroup").html(styleSizeHtml);
                 $("#styleGroup").select2();
                 // 规格尺寸画面回显
                 var styleSizeHtml = result["fitSizeHtml"];
                 $("#fitProperty").html(styleSizeHtml);
                 if (!disableFlg) {
                     onClickTd();
                 }
			 } else if (tabFlg == "MATERIAL_TAB") {
                 // 面料画面回显
                 var changeMaterialHtml = result["changeMaterialHtml"];
                 $("#changeMaterialBody").html(changeMaterialHtml);
                 var selLen = $("#changeMaterialBody").find("select").length-1;
                 for (var i = 0; i<selLen;i++) {
                     $("#mpt"+i).select2();
                     $("#selectTemp"+i).hide();
                 }
                 // 辅料画面回显
			 } else if (tabFlg=="FEED_BACK") {
				 // 意见要求画面回显
                 var feedBackHtml = result["feedBackHtml"];
                 $("#addOpinionBody").html(feedBackHtml);
			 } else if (tabFlg == "SAMPLE_FILE") {
                 // 样板文件画面回显
                 var uploadFileHtml = result["uploadFileHtml"];
                 $("#uploadFileMaterial").html(uploadFileHtml);
                 if (!disableFlg) {
                     // 对应画面调用table可编辑方法
                     callBackUpload()
                 }
			 } else if (tabFlg == "MASSAGE_FILE") {
                 // 资料画面回显
                 var uploadFileDataHtml = result["uploadFileDataHtml"];
                 $("#uploadFileData").html(uploadFileDataHtml);
                 if (!disableFlg) {
                     // 对应画面调用table可编辑方法
                     callBackUpload()
                 }
			 }
	     }, 'json');
	}
	// 选择组件的可查询插件
	function selectCheck() {
		$("#styleGroup,#sizeGroup,#myMaterialSeasonSelect,#bigcargoCustomerSelect,#StyleCategorySelect,#brandId").select2();
	}
	// 供货商与品牌连动方法
	function selectBrand(obj,id) {
        var code = $(obj).find("option:selected").attr("data-value");
        var param = {
            "bigcargoCustomer" : code
        };
        var pleaseSelect = '<option value="">' + '<spring:message code="style_pleaseSelect" />'+'</option>';
        $("#s2id_brandId").find(".select2-chosen").text('<spring:message code="style_pleaseSelect" />');
        $.post("${ctx}/bigcargo/style/selectBrandCn",param,function(result) {

            var html = "";
            var brandList = result["brandNameCnList"];
            $(brandList).each(function(i,e) {
                html += "<option value='"+e.apBrandId+"'>"
                    + e.brandCn
                    + "</option>";
			});
            $("#" + id).html(pleaseSelect+html);
        }, 'json');
    }
	// 供货商与品牌连动方法
	function findBrand(id1,id2) {
		id1 = id1.split('-')[0];
        var param = {
            "bigcargoCustomer" : id1,
            "brandId" : id2
        };
        var pleaseSelect = '<option value="">' + '<spring:message code="style_pleaseSelect" />'+'</option>';
        $("#s2id_brandId").find(".select2-chosen").text('<spring:message code="style_pleaseSelect" />');
        $.post("${ctx}/bigcargo/style/selectBrandCn",param,function(result) {

            var html = "";
            var brandList = result["brandNameCnList"];
            $(brandList).each(function(i,e) {
                html += "<option value='"+e.apBrandId
                if (e.apBrandId==$("#brandId2").val()) {
					
                	html += "' selected='selected'";
				}
                html += "'>"+ e.brandCn+"</option>";
			});
            $("#brandId").html(pleaseSelect+html);
            $("#brandId").select2();
        }, 'json');
    }
    // 面料画面迁移
    function selectMhangeMaterialLis() {
        // 客户取得
        var selectCode = $('#bigcargoCustomerSelect').find('option:selected').val();
        // 品牌ID
        var brandId = $('#brandId').find('option:selected').val();
        var venderId;
        if (brandId == "") {
            brandId = 0;
		}
		if (selectCode == "") {
            venderId = "";
		} else {
            venderId = selectCode.split("-")[0];
		}
		var url = "&materialTypeCd=MATERIAL_CATEGORY-Fabric_10&venderId="+venderId+"&brandId="+brandId;
        popup('1230px','680px','${ctx}/common/material/list?frameFlg=0'+url);
    }
    function poProcessAdd () {
        var selectCode = $('#StyleCategorySelect').find('option:selected').val();
        var selCd = selectCode.split("-");
        var category = selCd[0]+"-"+selCd[1];
        var venderId = $('#bigcargoCustomerSelect').find('option:selected').val();
        if (venderId=="") {
        	alert("请选择客户！");
        	return;
    	}else {
            venderId = venderId.split("-")[0];
		}
        var brandId = $('#brandId').find('option:selected').val();
        popup('900px','584px','${ctx}/produce/technology/add?imageFlg=fashionStyleCreate&category='+category+"&brandId="+brandId+"&venderId="+venderId);
	}
    /* 设置下标  */
    function setIndex(){
        var reg=/tempIndex/g;
		var trPr = $("#productionTable tr").length-1;
		var trMa = $("#changeMaterialBody tr").length-1;
		var trFe = $("#addOpinionBody tr").length-1;
		var trFl = $("#uploadFileData tr").length-1;
		if (trPr >= 1) {
			for (var i = 0; i < trPr; i++) {
                    var tableFit = $("#productionTable tr").eq(i+1);
					$(tableFit).html($(tableFit).html().replace(reg,i));
			}
		}
		if (trMa >= 1) {
			for (var i = 0; i < trMa; i++) {
                    var tableFit = $("#changeMaterialBody tr").eq(i+1);
                    $(tableFit).find("select")[0].name = 'changeMaterial.cgMatList['+i+'].cgMaterialPlacement';
                    $(tableFit).find("td").eq(12).html( $(tableFit).find("td").eq(12).html().replace(reg,i));
			}
		}
		if (trFe >= 1) {
			for (var i = 0; i < trFe; i++) {
                    var tableFit = $("#addOpinionBody tr").eq(i+1);
					$(tableFit).html($(tableFit).html().replace(reg,i));
			}
		}
		if (trFl >= 1) {
			for (var i = 0; i < trFl; i++) {
                    var tableFit = $("#uploadFileData tr").eq(i+1);
					$(tableFit).html($(tableFit).html().replace(reg,i));
			}
		}
	}
    function callBackStyleInfo(url,styleID,customerStyleNo) {
    	if (confirm("参考款式信息将覆盖现有信息，是否继续？")) {
	    	$.post("${ctx}/bigcargo/style/createStyle"+url,"",function(result) {
	    		$("#inputForm").html($(callBackHtml(result)).find("#inputForm").html());
	    		$("#StyleCategorySelect").select2();
	    		$("#bigcargoCustomerSelect").select2();
	    		$("#brandId").select2();
	    		$("#myMaterialSeasonSelect").select2();
	    		$("#sizeGroup").select2();
	    		$("#styleGroup").select2(); 
	    		var selLen = $("#changeMaterialBody").find("select").length-1;
	            for (var i = 0; i<selLen;i++) {
	                $("#tdTemp"+i).hide();
	                $("#mpt"+i).select2();
	            }
	    		findBrand($("#customer2").val(),$("#brandId2").val());
	    		checkBtnInputOff();
				$("#refStyleNo").val(customerStyleNo);
				$("#refStyleID").val(styleID);
	        }, 'html');
		}
	}
    
    //
    function controlSquareBtn(val) {
		var fileLength = val.split("|/");
		if (fileLength > 2) {
			$(".squareBtn").show();
		}else{
			$(".squareBtn").hide();
		}
	}
</script>
</head>
<body id="bodyHtml">
	<div class="layerHeader clearfix">
		<p class="headerTitle" id = "titleMessage">
			<c:choose>
			    <c:when test="${difKbn == 1}">
			      <spring:message code="edit_style" />
			    </c:when>
			   <c:otherwise>  
			      <spring:message code="create_style" />
			   </c:otherwise>
			  </c:choose>
		</p>
		<div class="headerButton clearfix"
			style="margin-top: 5px; margin-right: 45px;">
			 <shiro:hasPermission name="bigcargostyle:message:edit">
	       <button name="auxiliaryPlaneBatching" id="auxiliaryPlaneBatching"
			disabled="disabled"  onclick="selectMhangeMaterialLis()">
			<spring:message code="auxiliary_plane_batching" />
			</button>
			<button name="opinionRequest" id="opinionRequest" 
				disabled="disabled" onclick="popup('800px','470px','${ctx}/bigcargo/style/addStyleComments?uploadFlg=fashionStyleCreate')">
				<spring:message code="opinion_request" />
			</button>
				 <button id="produceAdd"
					disabled="disabled" onclick="poProcessAdd()">
					 <spring:message code="special_pro" />
				 </button>
			<button name="uploadFile" id="uploadFile" 
				disabled="disabled" onclick="fileUpload(0)">
				<spring:message code="upload_file" />
			</button>
			<button  id = "changeBtn">
				<spring:message code="btn_ok" />
			</button>
			 </shiro:hasPermission>
			<button onclick="closeWin()">
				<spring:message code="btn_cancle" />
			</button>
		</div>
	</div>
	<div class="tabBox">
		<ul class="clearfix">
			<li class="active"><spring:message code="style_message" /></li>
			<li><spring:message code="size_spec" /></li>
			<li><spring:message code="material_require" /></li>
			<li><spring:message code="opinion_request" /></li>
			<li><spring:message code="template_file" /></li>
			<li><spring:message code="material_file" /></li>
		</ul>
	</div>
	<form id="inputForm" method="post" >
	<div id = "fileListHidden">
	</div>
	<!-- 款式ID -->
	<input type ="hidden" id = "upStyleId" name ="styleID" value="0"/>
	<!-- 系统款式ID(款式图片) -->
	<input type ="hidden" id ="sysStyleId" name ="sysStyleId" />
	<!-- 编辑或新建 -->
	<input type ="hidden" id = "upOrCreateflg" name ="upOrCreateflg" value="1"/>
	<!-- 上传文件名称(款式图片) -->
	<input type ="hidden" id ="sysStyleName" name ="sysStyleName" />
	<!-- 文件路径(款式图片) -->
	<input type ="hidden" id ="sysStylePath" name ="sysStylePath" />
	<!-- 客户简称 -->
	<input type ="hidden" id ="ognizaitonSimpleName" name ="ognizaitonSimpleName" />
	<!-- 客户ID -->
	<input type ="hidden" id ="bigcargoCustomer" name ="bigcargoCustomer" />
	<!-- 季节ID -->
	<input type ="hidden" id ="materialSeasonCd" name ="materialSeasonCd" />
	<!-- 季节 -->
	<input type ="hidden" id ="materialSeason" name ="materialSeason" />
	<!-- 款式类别 -->
	<input type ="hidden" id ="styleCateGoryCd" name ="styleCateGoryCd" />
	<!-- 款式类别ID -->
	<input type ="hidden" id ="styleCategoryId" name ="styleCategoryId" />
	<!-- 制作单耗 -->
	<input type ="hidden" id ="sampleTypeChecked" name ="sampleTypeChecked" value = "0"/>
	<!-- 款式表创建时间 -->
	<input type ="hidden" id ="createDate" name ="createDate" value="${fns:getDate('yyyy-MM-dd HH:mm')}">
	<!-- 制作单耗 -->
	<input type ="hidden" id = "createUser" name ="createUser" value="${fns:getUser()}">
	<!-- 查看编辑区分 -->
	<input type ="hidden" id ="imgFlg" value="0">
	<input type = "hidden" 	id ="tmpStyleId" value="${bigcargoStyleTempID.styleID}"/>
	<input type = "hidden" id ="tmpUploadFile" value="${bigcargoStyleTempID.uploadFile}" disabled >
	<input type = "hidden" id ="difkbn" value="${difKbn}" disabled >
	<div class="tabBoxSm">
		<div class="tabSm styleTab1" id = "styleTable">
		<input type="hidden" name = "uploadFlg" id = "uploadFlg">
			<div class="clearfix">
				<div class="left w-350">
					<div style="height: 45px">&nbsp;</div>
					<div class="items clearfix haveToBox">
						<p class="tit">
							<!-- 客户款号 -->
							<spring:message code="customer_style_no" />
						</p>
						<input style="height: 30px; width: 280px;ime-mode:disabled;" onafterpaste="this.value=this.value.replace(/\D/g,'')" class ="inputClass" value="${bigcargoStyleTempID.customerStyleNo}" id ="customerStyleNo" name="customerStyleNo" data-rule-required="true" data-msg-required="<spring:message code="write_customer_no"/>" >
						<p class="haveTo">*</p>
					</div>
					<div class="items clearfix haveToBox">
						<p class="tit">
							<!-- 款式名称  -->
							<spring:message code="style_styleName" />
						</p>
						<input style="height: 30px; width: 280px" class ="inputClass" value="${bigcargoStyleTempID.styleNameCn}" id ="styleNameCn" name="styleNameCn" data-rule-required="true" data-msg-required="<spring:message code="write_style_name"/>">
						<p class="haveTo">*</p>
					</div>
					<div class="items clearfix haveToBox">
						<p class="tit">
							<!-- 款式类别  -->
							<spring:message code="style_styleCategory" />
						</p>
						<select style="width: 280px" id="StyleCategorySelect"
							name="StyleCategorySelect" onchange="changeSizeLayout()" data-rule-required="false" data-msg-required="<spring:message code="select_style_opinion"/>">
							<option value=""><spring:message
									code="style_pleaseSelect" /></option>
							<c:forEach items="${styleList}" var="item">
								<option <c:if test="${fn:split(bigcargoStyleTempID.styleTemp, '-')[1] eq item.itemValue}">selected="selected"</c:if>
										value="${item.itemCode}-${item.itemValue}-${item.itemSort}">${item.itemName}</option>
							</c:forEach>
						</select>
						<p class="haveTo">*</p>
					</div>
					<div class="items clearfix haveToBox">
						<p class="tit">
							<!-- 客   户   -->
							<spring:message code="big_cargo_customer" />
						</p>
						<select style="width: 280px;" id="bigcargoCustomerSelect" onclick="selectBrand(this,'brandId')"
							name="bigcargoCustomerSelect" data-rule-required="true" data-msg-required="<spring:message code="select_customer"/>">
							<option value=""><spring:message
									code="style_pleaseSelect" /></option>
							<c:forEach items="${bigcargoStyleTemp.selOgnlist}"
								var="ognization" varStatus="status">
								<option data-value="${ognization.selectOgnizationId}"
										<c:if test="${fn:split(bigcargoStyleTempID.styleOgnizaitonTemp, '-')[0] eq ognization.selectOgnizationId}">selected="selected"</c:if>
										value="${ognization.selectOgnizationId}-${ognization.ognizaitonSimpleName}">${ognization.selectOgnizationName}
								</option>
							</c:forEach>
						</select>
						<input type="hidden" id = "customer2" value="${bigcargoStyleTempID.styleOgnizaitonTemp }">
						<p class="haveTo">*</p>
					</div>
					<div class="items clearfix haveToBox" id="brandHtml">
						<p class="tit">
							<!-- 品牌   -->
							<spring:message code="bigcargo_brand_name_cn" />
						</p>
						<select style="width: 280px;" id="brandId" name = "brandId">
							<option value=""><spring:message
									code="style_pleaseSelect" /></option>
							<c:if test="brandNameCnList!=null">
							<c:forEach items="${brandNameCnList}"
									   var="item" varStatus="status">
								<option data-value="${item.apBrandId}"
										<c:if test="${bigcargoStyleTempID.brandId eq item.apBrandId}">selected="selected"</c:if>
										value="${item.apBrandId}">${item.brandCn}
								</option>
							</c:forEach>
							</c:if>
						</select>
						<input type="hidden" id = "brandId2" value="${bigcargoStyleTempID.brandId }">
					</div>
					<div class="items clearfix">
						<p class="tit">
							<!-- 参考款式   -->
							<spring:message code="reference_style" />
						</p>
						<input style="height: 30px; width: 230px" name ="refStyleNo" id ="refStyleNo" readonly="readonly" value="${bigcargoStyleTempID.refStyleNo}">
						<button id="refStyleBtn" type="button" onclick = "fileUpload(1);">
							<spring:message code="style_selectOK" />
						</button>
						<input type="hidden" id="refStyleID" name="refStyleID" value="${bigcargoStyleTempID.refStyleID}"/>
					</div>
					<%-- <div class="items clearfix item-season haveToBox">
						<p class="tit">
							<!-- 年份季节  -->
							<spring:message code="myMaterial_seasonAndYear" />
						</p>
						<input style="height: 30px; width: 75px" value="${bigcargoStyleTempID.styleYear}" class ="inputClass" id ="styleYear" name="styleYear" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="4" data-rule-required="true" data-msg-required="<spring:message code="write_style_year"/>">
						<select
							style="width: 200px" class="ml-5" id="myMaterialSeasonSelect"
							name="myMaterialSeasonSelect">
							<c:forEach items="${seasonList}" var="item">
								<option <c:if test="${fn:split(bigcargoStyleTempID.styleTempSeason, '-')[1] eq item.itemValue}">selected="selected"</c:if>
										value="${item.itemCode}-${item.itemValue}-${item.itemSort}">${item.itemName}</option>
							</c:forEach>
						</select>
						<p class="haveTo">*</p>
					</div> --%>
					<div class="items clearfix">
						<p class="tit">
							<!-- 款式颜色  -->
							<spring:message code="style_color" />
						</p>
						<input style="height: 30px; width: 280px" name ="styleColor" id ="styleColor" class ="inputClass" value="${bigcargoStyleTempID.styleColor}">
					</div>
					<div class="items clearfix haveToBox">
						<p class="tit">
							<!-- 尺码组  -->
							<spring:message code="size_group" />
						</p>
						<select style="width: 280px" id="sizeGroup" name="sizeGroup"
							onchange="styleSizeCdFun(this,'styleGroup')" data-rule-required="true" data-msg-required="<spring:message code="select_sizeGroup"/>">
							<option value=""><spring:message
									code="style_pleaseSelect" /></option>
							<c:forEach items="${groupSizeList}" var="item">
								<option data-value="${item.itemValue}" <c:if test="${fn:split(bigcargoStyleTempID.styleStyleGroupCd, '-')[1] eq item.itemValue}">selected="selected"</c:if>
										value="${item.itemCode}-${item.itemValue}">${item.itemName}</option>
							</c:forEach>
						</select>
						<p class="haveTo">*</p>
					</div>
					<div class="items clearfix haveToBox">
						<p class="tit">
							<!-- 款式尺码  -->
							<spring:message code="style_group" />
						</p>
						<select style="width: 280px ;border:1px solid #acacac" id="styleGroup" name="styleGroup"
							multiple="multiple" onchange = "styleFun(this);" data-rule-required="true" data-msg-required="<spring:message code="select_styleGroup"/>">

							<c:forEach items="${sumGroupList}" var="itemList" varStatus="inDex">
								<c:forEach
									items="${styleSizeList}" var="item" varStatus="status">
										<c:if test="${fn:split(item.styleGroup, '-')[1] eq itemList.itemValue}">
											<option value='${itemList.itemCode}-${itemList.itemValue}' selected='selected' tabIndex = "${inDex.index}">
													${itemList.itemNameCn}
											</option>
										</c:if>
								</c:forEach>
									<option value='${itemList.itemCode}-${itemList.itemValue}' tabIndex = "${inDex.index}">
											${itemList.itemNameCn}
									</option>
							</c:forEach>
						</select>
						<p class="haveTo">*</p>
					</div>
				</div>
				<div class="right w-500">
					<div class="items clearfix">
						<p class="tit">
						<!-- 款式图片 -->
							<spring:message code="bigcargo_style_stylePictures" />
						</p>
						<div class="styleImgBg clearfix" style="width: 310px; height: 300px; padding-top: 30px; margin-left: 25px; float: left;">
							<div class="squareBtn squareL" style="margin-left: -85px;margin-top:-57px">
								<img src="${ctxStatic}/images/btn_left.png">
							</div>
							 <c:set value="" var="myStyleFileTemp" />
						       <c:forEach items="${imageList}" var="styleFile">
								   <c:if test='${styleFile.fileKbn == "0"}'>
							   <c:set var="myStyleFileTemp"
							       value="${myStyleFileTemp}|${styleFile.filePath}${styleFile.uploadFileName}" />
								   </c:if>
						       </c:forEach>
						       <div class="square" style="width: 330px; height: 230px; margin-top: -1px; margin-left: -30px;">
							   <input type="hidden" id="nameImage" name="myStyleFile" value="${myStyleFileTemp}" htmlEscape="false" class="input-xlarge" onchange="controlSquareBtn(this.value)"/>
							   <sys:ckfinder input="nameImage" type="images"  uploadPath="/bigcargoStyle" selectMultiple="true" maxWidth="255" maxHeight="155" />
						       </div>
							<div class="squareBtn squareR" style="margin-top:-287px;margin-left:300px">
								<img src="${ctxStatic}/images/btn_right.png">
							</div>
						</div>
					</div>
					<div class="items clearfix">
						<p class="tit">
							<!-- 款式备注  -->
							<spring:message code="style_remark" />
						</p>
						<textarea style="height: 70px" name ="styleRemark" id ="styleRemark">${bigcargoStyleTempID.styleRemark}</textarea>
					</div>
				</div>

			</div>
		</div>
		<div class="tabSm none">
			<div class="tableArea">
				<div class="tableScroll" style="height:520px;width:650px;padding-top:0px" id ="fitProperty">
					<table cellpadding='0' id="tableSizeDis">
						<tr class="valTr">
							<td>
								<table>
									<tr>
										<th class='tabTemp-jd'><spring:message code="myStyle_fit_size" />\<spring:message code="myStyle_fit_position" /></th>
									</tr>
									<c:forEach items="${StyleOptionList}" var="items">
										<tr>
											<td class='tabTemp-xw'>${items.propertyNameCn}</td>
										</tr>
									</c:forEach>
								</table>
							</td>
							<td>
								<table class ="fitTableVal">
									<tr>
										<th style="width:70px"><spring:message code="myStyle_fit_public_errand" /></th>
									</tr>
								<c:forEach items="${styleFit}" var="items" varStatus="status">
										<c:if test='${items.styleSizeCd == "PUBLICERRAND_FITMAEKS"}'>
									<c:set value="${fn:split(items.itemCd,',')}" var="itemCdList2"/>
									<c:set value="${fn:split(items.itemValue,',')}" var="itemValueList2"/>
									<c:set value="${fn:split(items.publicErrand,',')}" var="publicErrandList"/>
									<c:forEach items="${publicErrandList}" var="publicErrand" varStatus="status">
											<tr >
												<td class='tab-xw' id = "publicErrand">${publicErrand}</td>
												<input type ='hidden' class='publicErrand' name = 'sampleTypeDataList.sampleTypeList[0].styleFit.styleFitList[0].publicErrand' value = '${publicErrand}'>
											</tr>
									</c:forEach>
									<c:forEach items="${itemCdList2}" var="itemCd" varStatus="status">
												<input type ='hidden' name = 'sampleTypeDataList.sampleTypeList[0].styleFit.styleFitList[0].itemCd' value = '${itemCd}'>
									</c:forEach>
									<c:forEach items="${itemValueList2}" var="itemValue" varStatus="status">
												<input type ='hidden' name = 'sampleTypeDataList.sampleTypeList[0].styleFit.styleFitList[0].itemValue' value = '${itemValue}'>
									</c:forEach>
									</c:if>
									</c:forEach>
									<input type ='hidden' class='styleGroup' name = 'sampleTypeDataList.sampleTypeList[0].styleGroup' value="PUBLICERRAND_FITMAEKS">
								</table>
							</td>
							<td>
								<table class ="fitTableVal">
									<tr>
										<th style="width:100px"><spring:message code="myStyle_fit_marks" /></th>
									</tr>
									<c:forEach items="${styleFit}" var="items" varStatus="status">
										<c:if test='${items.styleSizeCd == "PUBLICERRAND_FITMAEKS"}'>
										<c:set value="${fn:split(items.fitMarks,',')}" var="fitMarksList"/>
										<c:forEach items="${fitMarksList}" var="fitMarks" varStatus="status">
											<tr >
												<td class='tab-xw' id = "fitMarks">${fitMarks}</td>
												<input type ='hidden' class='fitMarks' name = 'sampleTypeDataList.sampleTypeList[0].styleFit.styleFitList[0].fitMarks' value = '${fitMarks}'>
											</tr>
										</c:forEach>
										</c:if>
									</c:forEach>
								</table>
							</td>
							<c:forEach items="${styleSizeList}" var="items" varStatus="status">
								<c:if test='${items.styleGroup != "PUBLICERRAND_FITMAEKS"}'>
									<td>
										<table class ="fitTableVal">
											<tr>
												<th class='tabTemp-jd' style="width:80px" >${fns:getDictName(items.styleSizeName)}</th>
											</tr>
											<c:forEach items="${styleFit}" var="itemsFit">
												<c:if test='${items.styleGroup eq itemsFit.styleSizeCd}'>
												<c:if test='${itemsFit.styleSizeCd != "PUBLICERRAND_FITMAEKS"}'>
												<c:set value="${fn:split(itemsFit.fitValue,',')}" var="fitValueList"/>
												<c:set value="${fn:split(itemsFit.itemCd,',')}" var="itemCdList"/>
												<c:set value="${fn:split(itemsFit.itemValue,',')}" var="itemValueList"/>
													<c:forEach items="${fitValueList}" var="fitValue">
															<tr >
																<td class='tab-xw' id = "fit">${fitValue}</td>
																<input type ='hidden' class='fit' name = 'sampleTypeDataList.sampleTypeList[${status.index+1}].styleFit.styleFitList[0].fitValue' value = '${fitValue}' >
															</tr>
													</c:forEach>
													<c:forEach items="${itemCdList}" var="itemCd">
																<input type ='hidden' name = 'sampleTypeDataList.sampleTypeList[${status.index+1}].styleFit.styleFitList[0].itemCd' value = '${itemCd}'>
													</c:forEach>
													<c:forEach items="${itemValueList}" var="itemValue">
																<input type ='hidden' name = 'sampleTypeDataList.sampleTypeList[${status.index+1}].styleFit.styleFitList[0].itemValue' value = '${itemValue}'>
													</c:forEach>
												</c:if></c:if>
											</c:forEach>
											<tr class='none'>
												<input type ='hidden' class='styleGroup' name = 'sampleTypeDataList.sampleTypeList[${status.index+1}].styleGroup' value = '${items.styleGroup}'>
											</tr>
										</table>
									</td>
								</c:if>
							</c:forEach>
							<td class = "none" >
								<table class ="fitTableVal">
									<tr>
										<th class='tabTemp-jd' style="width:80px" ></th>
									</tr>
									<c:forEach items="${StyleOptionList}" var="items" varStatus="status">
										<tr >
											<td class='tab-xw' id = "fit">-</td>
											<input type ='hidden' name = 'sampleTypeDataList.sampleTypeList[tempIndex].styleFit.styleFitList[0].itemCd' value = '${items.propertyCd}' disabled='disabled'>
											<input type ='hidden' name = 'sampleTypeDataList.sampleTypeList[tempIndex].styleFit.styleFitList[0].itemValue' value = '${items.propertyValue}' disabled='disabled'>
											<input type ='hidden' class='fit' name = 'sampleTypeDataList.sampleTypeList[tempIndex].styleFit.styleFitList[0].fitValue' value = '-' disabled='disabled' >
										</tr>
									</c:forEach>
									<tr class='none'>
										<input type ='hidden' class='styleGroup' name = 'sampleTypeDataList.sampleTypeList[tempIndex].styleGroup' disabled='disabled'>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
		<div class="tabSm none">
			<div class="tableArea">
				<div class="tableScroll tableScrollSm" style="overflow: auto;width: 650px;height: 520px;">
					<table cellpadding="0" class="tableHead" style="z-index: 999;">
						<thead>
							<tr>
								<th class="tab-cz"><spring:message code="dict_delete" /></th>
								<th class="tab-mfltp"><spring:message code="material_kbn" /></th>
								<th class="tab-mfltp"><spring:message code="myWarehouse_pic" /></th>
								<th class="width-120px"><spring:message
										code="myWarehouse_nameandcode" /></th>
								<%-- <th class="tab-mflkz"><spring:message
										code="myWareMaterialGramWeight" /></th> --%>
								<th class="tab-mflcf"><spring:message
										code="myWarehouse_Materialcomposition" /></th>
								<%-- <th class="tab-mflzsmd"><spring:message
										code="myWarehouse_Materialdensity" /></th> --%>
								<th class="tab-mflfg"><spring:message code="myWarehouse_MaterialStyle" /></th>
								<th class="tab-jjnf"><spring:message
										code="myWarehouse_MaterialColor" /></th>
								<th class="tab-mflzf"><spring:message code="myWarehouse_MaterialWeave" /></th>
								<th class="tab-mflsybw"><spring:message code="used_part" /></th>
								<th class="width-100px"><spring:message code="myWarehouse_inventory_quantity" /></th>
								<th class="width-100px"><spring:message code="myWarehouse_MaterialUnit" /></th>
								<th class="tab-mflbz"><spring:message code="warehouse_remark" /></th>
							</tr>
						</thead>
					</table>
					<table cellpadding="0" class="tableBody">
						<tbody id ="changeMaterialBody" name="changeMaterialBody">
						<tr class="none">
							<td class="tab-cz" onclick="removeFun(this)"><img src="${ctxStatic}/images/del_icon.png"
																			  class="delBtn"></td>
							<td class="tab-mfltp"></td>
							<td class="tab-mfltp"></td>
							<td class="width-120px"></td>
							<!-- <td class="tab-mflkz"></td> -->
							<td class="tab-mflcf"></td>
							<!-- <td class="tab-mflzsmd"></td> -->
							<td class="tab-mflfg"></td>
							<td class="tab-jjnf"></td>
							<td class="tab-mflzf"></td>
							<td class="tab-mflsybw">
								<select style="width: 145px ;border:1px solid #acacac" name="" multiple="multiple" size="3">
									<c:forEach items="${materialPlacement}" var="item">
										<option value="${item.itemCode}-${item.itemValue}" >${item.itemName}</option>
									</c:forEach>
								</select>
							</td>
							<td class="width-100px"></td>
							<td class="tabwrite-yy width-100px" id = "materialUnit"></td>
							<td class="tabwrite-bz" id = "materialRemarks"></td>
							<td style="display:none;"></td>
						</tr>
						<c:forEach items="${cgMaterialList}" var="cgList" varStatus="status">
								<tr class="">
									<td class="tab-cz" onclick="removeFun(this)"><img src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
									<td class="tab-mfltp">${fns:getDictName(cgList.cgMaterialTypeCd)}</td>
									<td>
										<c:choose>
											<c:when test="${cgList.cgMaterialFilePath!=''&&cgList.cgMaterialFilePath!=null}">
												<p class='tab-mfltp'><img src='${cgList.cgMaterialFilePath}${cgList.cgMaterialFileName}'></p>
											</c:when>
											<c:otherwise>
												<p class='tab-mfltp'><img src="${ctxStatic}/images/pic-none.jpg"></p>
											</c:otherwise>
										</c:choose>
									</td>
									<td class="width-120px">${cgList.cgMaterialNameCn}<br>${cgList.cgGaterialCd}</td>
									<%-- <td class="tab-mflkz">${cgList.materialgramWeight}</td> --%>
									<td class="tab-mflcf">${cgList.cgMaterialComposition}</td>
									<%-- <td class="tab-mflzsmd">${cgList.materialThreadCount}</td> --%>
									<td class="tab-mflfg">${fns:getDictName(cgList.materialStyle)}</td>
									<td class="tab-jjnf">${cgList.cgMaterialColor}</td>
									<td class="tab-mflzf">${fns:getDictName(cgList.materialWeave)}</td>
									<td class="tab-mflsybw">
										<c:set value="${ fn:split(cgList.cgMaterialPlacement, ',') }" var="placementItems" />
										<div id="tdTemp${status.index}">
											<c:forEach items="${placementItems}" var="planItems">
													${fns:getDictName(planItems)}<br>
											</c:forEach>
										</div>
										<div id="selectTemp${status.index}">
											<c:set var="flag" value="true" />
											<select style="width: 145px;border:1px solid #acacac" id="mpt${status.index}" name="changeMaterial.cgMatList[tempIndex].cgMaterialPlacement" multiple="multiple" >
												<c:forEach items="${materialPlacement}" var="item">
													<c:set var="flag" value="true" />
													<c:forEach items="${placementItems}" var="prItem">
														<c:set var="itemTemp" value="${item.itemCode}-${item.itemValue}" />
														<c:if test='${prItem eq itemTemp}'>
															<option value="${item.itemCode}-${item.itemValue}" selected="selected">${item.itemName}</option>
															<c:set var="flag" value="false" />
														</c:if>
													</c:forEach>
													<c:if test="${flag}">
														<option value="${item.itemCode}-${item.itemValue}">${item.itemName}</option>
													</c:if>
												</c:forEach>

											</select>
										</div>

									</td>
									<td class="width-100px"><fmt:formatNumber value="${cgList.materialQuantity}" pattern="#,##0.000#"/></td>
									<td class="tabwrite-yy width-100px" id = "materialUnit"><fmt:formatNumber value="${cgList.materialCostUnit}" pattern="#,##0.000#"/></td>
									<td class="tabwrite-bz" id = "materialRemarks">${cgList.cgMaterialRemarks}</td>
									<td style="display:none;">
										<input type='hidden' class = 'materialRemarks' name='changeMaterial.cgMatList[tempIndex].cgMaterialRemarks' value="${cgList.cgMaterialRemarks}"/>
										<input type='hidden' class = 'materialUnit' name='changeMaterial.cgMatList[tempIndex].materialCostUnit' value="${cgList.materialCostUnit}"/>
										<input type='hidden' name='changeMaterial.cgMatList[tempIndex].cgMaterialStageCd' value='AUDIT_PHASE_CD-PHASE_CD_10'/>
										<input type='hidden' name='changeMaterial.cgMatList[tempIndex].materialUnitPrice' value='${cgList.materialUnitPrice}'/>
										<input type='hidden' name='changeMaterial.cgMatList[tempIndex].cgMaterialId' value='${cgList.cgMaterialId}'/>
									</td>
								</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="tabSm none">
			<div class="tableArea">
				<div class="tableScroll tableScrollSm">
					<table cellpadding="0" class="tableHead">
						<thead>
							<tr>
								<th class="tab-cz"><spring:message code="dict_delete" /></th>
								<th class="tab-wllb"><spring:message
										code="opinion_moment" /></th>
								<th class="tab-wlfujian"><spring:message
										code="opinion_add_file" /></th>
								<th class="tab-optionyj"><spring:message
										code="opinions_requirements" /></th>
								<th class="tab-cjz"><spring:message code="style_creator" /></th>
								<th class="tab-cjrq"><spring:message code="style_creatDate" /></th>
							</tr>
						</thead>
					</table>
					<table cellpadding="0" class="tableBody">
						<tbody id ="addOpinionBody" name="addOpinionBody">
							<tr class="none">
								<td class="tab-cz" onclick = "removeFun(this)"><img src="${ctxStatic}/images/del_icon.png"
									class="delBtn"></td>
								<td class="tab-wllb"></td>
								<td class="tab-wlfujian"></td>
								<td class="tab-optionyj" align="left"></td>
								<td class="tab-cjz"></td>
								<td class="tab-cjrq"></td>
								<td style="display:none;"></td>
							</tr>
						<c:forEach items="${feedBackList}" var="fbList" varStatus="status">
								<tr>
									<td class="tab-cz" onclick="removeFun(this)"><img src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
									<td class="tab-wllb"> ${fns:getDictName(fbList.phaseCd)}</td>
									<td class="tab-wlfujian">
										<c:forEach items="${fbList.uploadFileData.uploadDataList}" var="fbFile" varStatus="s_index">
											<a href="${fbFile.filePath}${fbFile.uploadFileName}" url="${fbFile.filePath}${fbFile.uploadFileName}" target='_blank'>${fbFile.uploadFileName}</a><br>
											<input type ="hidden" name="styleFeedBack.styleFeedBackList[tempIndex].uploadFileData.uploadStyleList[${s_index.index}].uploadFileName" value = "${fbFile.uploadFileName}"/>
											<input type ="hidden" name="styleFeedBack.styleFeedBackList[tempIndex].uploadFileData.uploadStyleList[${s_index.index}].filePath" value = "${fbFile.filePath}"/>
											<input type ="hidden" name="styleFeedBack.styleFeedBackList[tempIndex].uploadFileData.uploadStyleList[${s_index.index}].fileKbn" value = "2"/>
											<input type ="hidden" name="styleFeedBack.styleFeedBackList[tempIndex].uploadFileData.uploadStyleList[${s_index.index}].ftpFile" value = "/optionFile" />
											<input type ="hidden" name="styleFeedBack.styleFeedBackList[tempIndex].uploadFileData.uploadStyleList[${s_index.index}].moduleKbn" value = "2" />
										</c:forEach>
									</td>
									<td class="tab-optionyj" align="left">${fbList.feedRemarks}</td>
									<td class="tab-cjz">${user}</td>
									<td class="tab-cjrq"><fmt:formatDate value="${fbList.createTime}" pattern="yyyy-MM-dd hh:mm" type="date" dateStyle="long" /> </td>
									<td style="display:none;">
										<input name="styleFeedBack.styleFeedBackList[tempIndex].phaseCd" value="${fbList.phaseCd}" type="hidden">
										<input name="styleFeedBack.styleFeedBackList[tempIndex].createUser" value="${fbList.createUser}" type="hidden">
										<input name="styleFeedBack.styleFeedBackList[tempIndex].createTime" value='<fmt:formatDate value="${fbList.createTime}" pattern="yyyy-MM-dd hh:mm:ss" type="date" dateStyle="long" />' type="hidden">
										<input name="styleFeedBack.styleFeedBackList[tempIndex].feedRemarks" value="${fbList.feedRemarks}" type="hidden">
									</td>
								</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>

		<div class="tabSm none">
			<div class="tableArea">
				<div class="tableScroll tableScrollSm" style="overflow: auto;width: 650px;height: 520px;">
					<table cellpadding="0" class="tableHead">
						<thead>
							<tr>
								<th class="tab-cz"><spring:message code="dict_delete" /></th>
								<th class="tab-gylb"><spring:message
										code="production_process_category" /></th>
								<th class="tab-gytp"><spring:message code="production_process_picture" /></th>
								<th class="tab-gysm"><spring:message code="production_process_illustrate" /></th>
								<th class="tab-gyry"><spring:message code="production_process_updataUser" /></th>
                                <th class="tab-gysj"><spring:message code="production_process_updataTime" /></th>
                                <th class="tab-gyry"><spring:message code="production_process_createUser" /></th>
                                <th class="tab-gysj"><spring:message code="production_process_createTime" /></th>
							</tr>
						</thead>
					</table>
					<table cellpadding="0" class="tableBody">
						<tbody id ="productionTable">
						<tr class="none">
							<td class="tab-cz"onclick = "removeFun(this)" >
								<img src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
							<td class="tab-gylb"></td>
							<td class="tab-gytp"></td>
							<td class="tab-gysm"></td>
							<td class="tab-gyry"></td>
							<td class="tab-gysj"></td>
							<td class="tab-gyry"></td>
							<td class="tab-gysj"></td>
							<td class="none" >
							</td>
						</tr>
						<c:forEach items="${productionList}" var="item" varStatus="status">
							<tr>
								<td class="tab-cz"onclick = "removeFun(this)" >
									<img src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
								<td class="tab-gylb">${fns:getDictName(item.craftType)}</td>
								<td class="tab-gytp">
									<img src="${item.fileImage}" height="100" width="100">
								</td>
								<td class="tab-gysm">${item.remarks}</td>
								<td class="tab-gyry">${item.updataUser}</td>
								<td class="tab-gysj"><fmt:formatDate pattern="yyyy-MM-dd hh:mm" value="${item.updataTime}" /></td>
								<td class="tab-gyry">${item.createUser}</td>
								<td class="tab-gysj"><fmt:formatDate pattern="yyyy-MM-dd hh:mm" value="${item.createTime}" /></td>
								<td class="none" >
									<input type="hidden"  name="productionEntity.productionList[tempIndex].craftId" value="${item.craftId}">
								</td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="tabSm none">
			<div class="tableArea">
				<div class="tableScroll tableScrollSm">
					<table cellpadding="0" class="tableHead">
						<thead>
							<tr>
								<th class="tab-cz"><spring:message code="dict_delete" /></th>
								<th class="tab-zlwjmc"><spring:message
										code="data_file_name" /></th>
								<th class="tab-bz-2"><spring:message code="common_remarks" /></th>
								<th class="tab-scsj"><spring:message code="upload_time" /></th>
								<th class="tab-cjz"><spring:message code="upload_user" /></th>
							</tr>
						</thead>
					</table>
					<table cellpadding="0" class="tableBody">
						<tbody id ="uploadFileData" name="uploadFileData">
							<tr class="none">
								<td class="tab-cz" onclick = "removeFun(this)" ><img src="${ctxStatic}/images/del_icon.png"
									class="delBtn"></td>
								<td class="tab-zlwjmc"></td>
								<td class="tab-bz-2" style = "background-color:white"></td>
								<td class="tab-scsj"></td>
								<td class="tab-cjz">${user}</td>
								<td style="display:none;"></td>
							</tr>
							<c:set var="count" value="0"/>
							<c:forEach items="${imageList}" var="igItem" varStatus="status">
								<c:if test="${igItem.fileKbn == 1}">
									<tr class="">
										<td class="tab-cz" onclick="removeFun(this)"><img src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
										<td class="tab-zlwjmc"><a href="${igItem.filePath}${igItem.uploadFileName}" url="${igItem.filePath}${igItem.uploadFileName}" target='_blank'>${igItem.uploadFileName}</a><br></td>
										<td class="tab-bz-2" style = "background-color:white">${igItem.fileRemarks}</td>
										<td class="tab-scsj"><fmt:formatDate value="${igItem.createDate}" pattern="yyyy-MM-dd hh:mm" type="date" dateStyle="long" /></td>
										<td class="tab-cjz">${user}</td>
										<td style="display:none;">
											<input name="uploadFileData.uploadDataList[tempIndex].uploadFileName" value="${igItem.uploadFileName}" type="hidden">
											<input name="uploadFileData.uploadDataList[tempIndex].filePath" value="${igItem.filePath}" type="hidden">
											<input class="remarks" name="uploadFileData.uploadDataList[tempIndex].fileRemarks" value="${igItem.fileRemarks}" type="hidden">
											<input name="uploadFileData.uploadDataList[tempIndex].createUser" value="${igItem.createUser}" type="hidden">
											<input name="uploadFileData.uploadDataList[tempIndex].createTime" value='<fmt:formatDate value="${igItem.createDate}" pattern="yyyy-MM-dd hh:mm:ss" type="date" dateStyle="long" />' type="hidden">
											<input name="uploadFileData.uploadDataList[tempIndex].ftpFile" value="/bigcargoStyleFile" type="hidden">
											<input name="uploadFileData.uploadDataList[tempIndex].fileKbn" value="1" type="hidden">
											<input name="uploadFileData.uploadDataList[tempIndex].moduleKbn" value="2" type="hidden">
										</td>
									</tr>
									<c:set var="count" value="${count+1}" />
								</c:if>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	</form>
	<script>
		$('.squareL').on('click', function() {
            var lastCon = $('.square ol li:last-child').detach();
            $('.square ol').prepend(lastCon)
            $('.square ol li:last-child').addClass('active')
            $('.square ol li:last-child').siblings().removeClass('active')
        })

        $('.squareR').on('click', function() {
            var lastCon = $('.square ol li:first-child').detach();
            $('.square ol').append(lastCon)
            $('.square ol li:last-child').addClass('active')
            $('.square ol li:last-child').siblings().removeClass('active')
        })
	</script>
</body>
</html>
